(function(window, undefined){
	var $win	= $(window),
		$doc	= $(document),
		Fn		= function(){},
		init	= {};
		
/**************************** BEGIN ****************************/

	/**
	 * 节目
	 * @method init.repertoire
	 * @since 1.0
	 * @return {none}
	 */
	init.repertoire = function(){
		var allH = Number($win.height());
		$('.J_xcontent').height(allH);

		/* 鼠标 */
		var len 	= $('.m_xsubstan').size() - 1,
			keys 	= 0;
		$('.J_xwraps').fullpage({
			anchors: ['page1', 'page2', 'page3', 'page4', 'page5'],
			menu: '#menu',

        });

		first();
		/* 第一屏 */
        function first(){
        	$('.J_xversion p').each(function(k , v){
    			$(v).addClass('abs_' + (k + 1));
    		});
    		setTimeout(function(){
    			$('.J_xversion p').each(function(k , v){
	        		$(v).removeClass('abs_' + (k + 1))
	        	});
    		} , 2500);
        }
	}

	/**
	 * 首页
	 * @method init.homepage
	 * @since 1.0
	 * @return {none}
	 */
	init.homepage = function(){
		var len = $('.J_xtrends li').length,
		    w   = $('.J_xtrends li:first').outerWidth();
		$('.J_xtrends').width(len * w);
		$('.J_xtrends li').width(w);
		//下一张
		function nextPic(){
			var first = $('.J_xtrends li:first');
			if(!first.is(':animated')){
				first.stop().animate({'marginLeft':-w},500,function(){
					first.appendTo($('.J_xtrends ul'));
					first.css({'marginLeft':0})
				});
			}
		}
		$('.J_xnext').bind('click',nextPic);

		//上一张
		function prevPic(){
			$('.J_xtrends li:last').prependTo($('.J_xtrends ul'));
			$('.J_xtrends li:first').css({'marginLeft':-w+'px'});
			$('.J_xtrends li:first').stop().animate({'marginLeft':0});
		};
		$('.J_xprev').bind('click',prevPic);
	}


/**************************** END ****************************/

	$.each(init, function(){
		typeof this === 'function' && this();
	});
})(window);



